// import Home from '@/views/Home';
// import About from '@/views/About';
// import Blog from '@/views/Blog';
// import BlogDetail from '@/views/Blog/Detail';
// import Project from '@/views/Project';
// import Message from '@/views/Message';
import NotFound from '@/views/NotFound';

import 'nprogress/nprogress.css';
import { start, done, configure } from 'nprogress';
configure({
  trickleSpeed: 50
});

function getPageComponent(pageCompResolver) {
  return async () => {
    start();
    const comp = await pageCompResolver();
    done();
    return comp;
  };
}

export default [
  {
    name: 'Home',
    path: '/',
    component: getPageComponent(() => import('@/views/Home')),
    meta: {
      title: '首页'
    }
  },
  {
    name: 'About',
    path: '/about',
    component: getPageComponent(() => import('@/views/About')),
    meta: {
      title: '关于我'
    }
  },
  {
    name: 'Blog',
    path: '/blog',
    component: getPageComponent(() => import('@/views/Blog')),
    meta: {
      title: '文章'
    }
  },
  {
    name: 'CategoryBlog',
    path: '/blog/cate/:categoryId',
    component: getPageComponent(() => import('@/views/Blog')),
    meta: {
      title: '文章'
    }
  },
  {
    name: 'BlogDetail',
    path: '/blog/:id',
    component: getPageComponent(() => import('@/views/Blog/Detail')),
    meta: {
      title: '文章详情'
    }
  },
  {
    name: 'Project',
    path: '/project',
    component: getPageComponent(() => import('@/views/Project')),
    meta: {
      title: '项目&效果'
    }
  },
  {
    name: 'Message',
    path: '/message',
    component: getPageComponent(() => import('@/views/Message')),
    meta: {
      title: '留言板'
    }
  },

  {
    name: 'NotFound',
    path: '*',
    component: NotFound
  }
];
